<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SDL2_gfx
   &#160;<span id="projectnumber">1.0.1</span>
   </div>
   <div id="projectbrief">GraphicsprimitivesandsurfacefunctionsforSDL2</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">I:/Sources/sdl2gfx/SDL2_framerate.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;SDL.h&quot;</code><br/>
</div>
<p><a href="_s_d_l2__framerate_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Structure holding the state and timing information of the framerate controller.  <a href="struct_f_p_smanager.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr class="memitem:aeaeac0f0b439344496e29abf60904d58"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">FPS_UPPER_LIMIT</a>&#160;&#160;&#160;200</td></tr>
<tr class="memdesc:aeaeac0f0b439344496e29abf60904d58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Highest possible rate supported by framerate controller in Hz (1/s).  <a href="#aeaeac0f0b439344496e29abf60904d58"></a><br/></td></tr>
<tr class="memitem:a9555dceeaaffdd2669c991e6a300085b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">FPS_LOWER_LIMIT</a>&#160;&#160;&#160;1</td></tr>
<tr class="memdesc:a9555dceeaaffdd2669c991e6a300085b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lowest possible rate supported by framerate controller in Hz (1/s).  <a href="#a9555dceeaaffdd2669c991e6a300085b"></a><br/></td></tr>
<tr class="memitem:ab3ac02e6acb348129a019b9f20aa5c90"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">FPS_DEFAULT</a>&#160;&#160;&#160;30</td></tr>
<tr class="memdesc:ab3ac02e6acb348129a019b9f20aa5c90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default rate of framerate controller in Hz (1/s).  <a href="#ab3ac02e6acb348129a019b9f20aa5c90"></a><br/></td></tr>
<tr class="memitem:af0b200240224bd14f4d63d0491176abe"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a>&#160;&#160;&#160;extern</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a843f0672446aff01ef03bbcd977fbedf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#a843f0672446aff01ef03bbcd977fbedf">SDL_initFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr>
<tr class="memdesc:a843f0672446aff01ef03bbcd977fbedf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the framerate manager.  <a href="#a843f0672446aff01ef03bbcd977fbedf"></a><br/></td></tr>
<tr class="memitem:aa2f7f11e60d81489392707faf07c5ac5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#aa2f7f11e60d81489392707faf07c5ac5">SDL_setFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager, Uint32 rate)</td></tr>
<tr class="memdesc:aa2f7f11e60d81489392707faf07c5ac5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the framerate in Hz.  <a href="#aa2f7f11e60d81489392707faf07c5ac5"></a><br/></td></tr>
<tr class="memitem:aebe43457dbb9fbfec6de18e7adf49e21"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#aebe43457dbb9fbfec6de18e7adf49e21">SDL_getFramerate</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr>
<tr class="memdesc:aebe43457dbb9fbfec6de18e7adf49e21"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current target framerate in Hz.  <a href="#aebe43457dbb9fbfec6de18e7adf49e21"></a><br/></td></tr>
<tr class="memitem:a41de3f516b9633f102d7ba2e85d2bb98"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#a41de3f516b9633f102d7ba2e85d2bb98">SDL_getFramecount</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr>
<tr class="memdesc:a41de3f516b9633f102d7ba2e85d2bb98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the current framecount.  <a href="#a41de3f516b9633f102d7ba2e85d2bb98"></a><br/></td></tr>
<tr class="memitem:afc3b999d59d913771cd2588299096274"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> Uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l2__framerate_8h.html#afc3b999d59d913771cd2588299096274">SDL_framerateDelay</a> (<a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *manager)</td></tr>
<tr class="memdesc:afc3b999d59d913771cd2588299096274"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delay execution to maintain a constant framerate and calculate fps.  <a href="#afc3b999d59d913771cd2588299096274"></a><br/></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ab3ac02e6acb348129a019b9f20aa5c90"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="_s_d_l2__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">FPS_DEFAULT</a>&#160;&#160;&#160;30</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Default rate of framerate controller in Hz (1/s). </p>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8h_source.html#l00057">57</a> of file <a class="el" href="_s_d_l2__framerate_8h_source.html">SDL2_framerate.h</a>.</p>

</div>
</div>
<a class="anchor" id="a9555dceeaaffdd2669c991e6a300085b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="_s_d_l2__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">FPS_LOWER_LIMIT</a>&#160;&#160;&#160;1</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Lowest possible rate supported by framerate controller in Hz (1/s). </p>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8h_source.html#l00052">52</a> of file <a class="el" href="_s_d_l2__framerate_8h_source.html">SDL2_framerate.h</a>.</p>

</div>
</div>
<a class="anchor" id="aeaeac0f0b439344496e29abf60904d58"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="_s_d_l2__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">FPS_UPPER_LIMIT</a>&#160;&#160;&#160;200</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Highest possible rate supported by framerate controller in Hz (1/s). </p>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8h_source.html#l00047">47</a> of file <a class="el" href="_s_d_l2__framerate_8h_source.html">SDL2_framerate.h</a>.</p>

</div>
</div>
<a class="anchor" id="af0b200240224bd14f4d63d0491176abe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a>&#160;&#160;&#160;extern</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8h_source.html#l00082">82</a> of file <a class="el" href="_s_d_l2__framerate_8h_source.html">SDL2_framerate.h</a>.</p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="afc3b999d59d913771cd2588299096274"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> Uint32 <a class="el" href="_s_d_l2__framerate_8h.html#afc3b999d59d913771cd2588299096274">SDL_framerateDelay</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td>
          <td class="paramname"><em>manager</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Delay execution to maintain a constant framerate and calculate fps. </p>
<p>Generate a delay to accomodate currently set framerate. Call once in the graphics/rendering loop. If the computer cannot keep up with the rate (i.e. drawing too slow), the delay is zero and the delay interpolation is reset.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The time that passed since the last call to the function in ms. May return 0. </dd></dl>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8c_source.html#l00146">146</a> of file <a class="el" href="_s_d_l2__framerate_8c_source.html">SDL2_framerate.c</a>.</p>

</div>
</div>
<a class="anchor" id="a41de3f516b9633f102d7ba2e85d2bb98"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l2__framerate_8h.html#a41de3f516b9633f102d7ba2e85d2bb98">SDL_getFramecount</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td>
          <td class="paramname"><em>manager</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the current framecount. </p>
<p>Get the current framecount from the framerate manager. A frame is counted each time SDL_framerateDelay is called.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Current frame count or -1 for error. </dd></dl>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8c_source.html#l00126">126</a> of file <a class="el" href="_s_d_l2__framerate_8c_source.html">SDL2_framerate.c</a>.</p>

</div>
</div>
<a class="anchor" id="aebe43457dbb9fbfec6de18e7adf49e21"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l2__framerate_8h.html#aebe43457dbb9fbfec6de18e7adf49e21">SDL_getFramerate</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td>
          <td class="paramname"><em>manager</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the current target framerate in Hz. </p>
<p>Get the currently set framerate of the manager.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">manager</td><td>Pointer to the framerate manager.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Current framerate in Hz or -1 for error. </dd></dl>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8c_source.html#l00107">107</a> of file <a class="el" href="_s_d_l2__framerate_8c_source.html">SDL2_framerate.c</a>.</p>

</div>
</div>
<a class="anchor" id="a843f0672446aff01ef03bbcd977fbedf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> void <a class="el" href="_s_d_l2__framerate_8h.html#a843f0672446aff01ef03bbcd977fbedf">SDL_initFramerate</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td>
          <td class="paramname"><em>manager</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialize the framerate manager. </p>
<p>Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8c_source.html#l00062">62</a> of file <a class="el" href="_s_d_l2__framerate_8c_source.html">SDL2_framerate.c</a>.</p>

</div>
</div>
<a class="anchor" id="aa2f7f11e60d81489392707faf07c5ac5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> int <a class="el" href="_s_d_l2__framerate_8h.html#aa2f7f11e60d81489392707faf07c5ac5">SDL_setFramerate</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a> *&#160;</td>
          <td class="paramname"><em>manager</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Uint32&#160;</td>
          <td class="paramname"><em>rate</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the framerate in Hz. </p>
<p>Sets a new framerate for the manager and reset delay interpolation. Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">manager</td><td>Pointer to the framerate manager. </td></tr>
    <tr><td class="paramname">rate</td><td>The new framerate in Hz (frames per second).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>0 for sucess and -1 for error. </dd></dl>

<p>Definition at line <a class="el" href="_s_d_l2__framerate_8c_source.html#l00086">86</a> of file <a class="el" href="_s_d_l2__framerate_8c_source.html">SDL2_framerate.c</a>.</p>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
